package effect;

import core.MapUtil;
import card.CreatureCard;
import card.lands.Plains;
import effect.Effect.EffectType;

/**
 * 
 * @author Oskar
 *
 * Let's the unit harvest a plains to gain 1 gold. The creature is able to harvest
 * if it is in a plains land and has his actions left at the end of the turn.
 */
public class Harvest extends Effect{
	int addedGold = 1;
	
	public Harvest(){
		name="Harvest";
		description="The peasant harvest the plains if he is in a plains and has actions left by the end of the turn. Harvesting gives 1 gold.";
		imageName="cardIconHarvest.png";
		effectTypes.add(EffectType.triggerOnTurnEnd);
		effectTypes.add(EffectType.goldModifier);
	}
	
	public void triggerOnTurnEnd(){
		CreatureCard temp = (CreatureCard) EffectUtil.getCard(this);
		System.out.println(temp.getActionsLeft());
		if(MapUtil.getTileOfCard(temp).getLandCard() instanceof Plains)
			EffectUtil.getCard(this).getOwner().addGold(addedGold);
		//TODO Fix so it only triggers if they unit hasn't moved this turn.
	}
}
